/* eslint-disable */
// @ts-ignore
import request from '@/utils/request';
import { CustomRequestOptions } from '@/interceptors/request';

import * as API from './types';

/** 分页查询公告 GET /notice */
export async function noticeGetNoticePage({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.NoticeGetNoticePageParams;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelResponseDataListModelNoticeModel_>(
    '/notice',
    {
      method: 'GET',
      params: {
        ...params,
      },
      ...(options || {}),
    }
  );
}

/** 编辑公告 PUT /notice */
export async function noticeEditNotice({
  params,
  body,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.NoticeEditNoticeParams;
  body: API.UpsertNoticeModel;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/notice', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: {
      ...params,
    },
    data: body,
    ...(options || {}),
  });
}

/** 新增公告 POST /notice */
export async function noticeAddNotice({
  body,
  options,
}: {
  body: API.UpsertNoticeModel;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/notice', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除公告 DELETE /notice */
export async function noticeDeleteNotice({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.NoticeDeleteNoticeParams;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/notice', {
    method: 'DELETE',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 查询公告详情 GET /notice/${param0} */
export async function noticeGetNoticeDetail({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.NoticeGetNoticeDetailParams;
  options?: CustomRequestOptions;
}) {
  const { id: param0, ...queryParams } = params;

  return request<API.ResponseModelNoticeModel_>(`/notice/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 查询公告列表 GET /notice/list */
export async function noticeGetNoticeList({
  options,
}: {
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelListNoticeModel_>('/notice/list', {
    method: 'GET',
    ...(options || {}),
  });
}
